package com.example.canalclientsync.es.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 个人空间文件来源
 *
 * @author chen.cr
 * @since 2023/9/15
 */
@AllArgsConstructor
@Getter
public enum EsPersonalFileOriginTypeEnum {

    LOCAL(0),
    PROJECT(1),
    DEPARTMENT(2),
    PERSONAL(3),
    OTHER(9)
    ;

    private final int type;

    public static EsPersonalFileOriginTypeEnum typeOf(int originType) {
        for (EsPersonalFileOriginTypeEnum value : EsPersonalFileOriginTypeEnum.values()) {
            if (value.getType() == originType) {
                return value;
            }
        }
        return OTHER;
    }
}
